<#import "../tpl/pageTep.ftl" as page>
    <@page.pageBase currentMenu="称重记录">

    <!--suppress ALL -->
    <form id="searchForm" class="form-panel"  action="loadData" method="get">
        <ul class="panel-content">
            <li style="height: auto;overflow: hidden">
                <div class="control-group controls span5">
                    <label class=" label-text">
                        采砂场：
                    </label>
                        <select name="sandpit" class="sandpit "  >  <option value="">全部</option><option value="马庄">马庄</option><option value="涂庄">涂庄</option></select>
                </div>
                <div class="control-group controls span5">
                    <label class=" label-text">
                        车牌号：
                    </label>
                        <input type="text" class="input-normal  input-pad cartNo label-input" name="cartNo" id="rank">
                </div>
                <div class="control-group controls span6">
                    <label class=" pull-left">
                        开始时间：
                    </label>
                    <div class="pull-left ">
                        <input name="startDate" class="input-small  calendar-time calendar  input-pad startDate" type="text">
                    </div>
                </div>
                <div class="control-group controls span6">
                    <label class=" pull-left">
                        结束时间：
                    </label>
                    <div class="pull-left">
                        <input name="endDate" class="input-small  calendar-time calendar  input-pad endDate" type="text">
                    </div>
                </div>
                    <div class="form-actions  controls">
                        <button type="submit" class="button button-small button-success">
                            查询
                        </button>
                    </div>
                    <div class="form-actions  controls">
                        <a  class="button button-small button-danger" onclick="refresh()">
                            重置
                        </a>
                    </div>
                    <div class="form-actions  controls">

                        <a  class="button button-small button-info" id="export" >
                         导出
                        </a>
                    </div>
            </li>
        </ul>
    </form>
    <div id="grid"></div>
<script>
var Grid = BUI.Grid,
 Calendar = BUI.Calendar,
 datepicker = new Calendar.DatePicker({
    trigger:'.calendar-time',
     dateMask :'yyyy-mm-dd HH:MM:ss',
    showTime:true,
    autoRender : true
}),
        Store = BUI.Data.Store,
        columns = [
            {title : '采砂场',elCls: 'center',  dataIndex :'sandpit', width:'5%'},
            {title : '工作站',elCls: 'center',  dataIndex :'workstation', width:'5%'},
            {title : '卡号',elCls: 'center',  dataIndex :'cardNo', width:'10%'},
            {title : '凭证号',elCls: 'center', dataIndex :'voucherNo', width:'10%'},
            {title : '车牌号',elCls: 'center', dataIndex :'cartNo', width:'10%'},
            {title : '司机',elCls: 'center', dataIndex :'driver', width:'10%',renderer:function (value){
                    return value||'-';
                } },
            {title : '品名',elCls: 'center', dataIndex :'productName', width:'10%'},
            {title : '毛重(KG)',elCls: 'center', dataIndex :'totalWeight', width:'6%'},
            {title : '皮重(KG)',elCls: 'center', dataIndex :'cartWeight', width:'6%'},
            {title : '净重(KG)',elCls: 'center', dataIndex :'sandWeight', width:'6%'},
            {title : '金额(元)',elCls: 'center', dataIndex :'money', width:'6%'},
            {title : '时间',elCls: 'center',dataIndex :'createTime', width:'10%'},
            {title : '操作者',elCls: 'center',dataIndex :'createUser', width:'6%'}
        ];

var store = new Store({
            url : 'loadData',
            autoLoad:true, //自动加载数据
            params : { //配置初始请求的参数
                length : '10',
                status:$("#status").val()
            },
            pageSize:10,	// 配置分页数目
            root : 'list',
            totalProperty : 'total'
        }),
        grid = new Grid.Grid({
            render:'#grid',
            columns : columns,
            loadMask: true, //加载数据时显示屏蔽层
            store: store,
            // 底部工具栏
            bbar:{
                pagingBar:true
            }
        });

grid.render();
//查询框
var form = new BUI.Form.HForm({
    srcNode: '#searchForm'
}).render();

form.on('beforesubmit', function (ev) {
    var obj = form.serializeToObject();
    obj.start = 0; //返回第一页
    store.load(obj);
    return false;
});
function refresh() {
    window.location.href="/rest/manage/weightrecord/toList"
}
$('#export').click(function () {
    var endDate=$('.endDate').val();
    var startDate=$('.startDate').val();
    var cartNo=$('.cartNo').val();
    var sandpit=$('.sandpit').val();
    var productName=$('.productName').val();
    window.location.href="/rest/manage/weightrecord/excelDownload?productName="+productName+'&sandpit='+sandpit+'&cartNo='+cartNo+'&startDate='+startDate+'&endDate'+endDate;
})

</script>

</@page.pageBase>
